package m.jclecai.com.base.recyclerview;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

/**
 * Created by andy on 2017/7/4.
 */

public class BaseViewHolder extends RecyclerView.ViewHolder {

    public BaseViewHolder(View itemView) {
        super(itemView);
    }


    public ImageView getImageView(int viewResId){
        return retrieveView(viewResId);
    }

    public TextView getTextView(int viewResId){
        return retrieveView(viewResId);
    }

    public Button getButton (int buttonRes){return retrieveView(buttonRes);}

    public View getView(int viewResId){
        return retrieveView(viewResId);
    }

    public <T extends View> T retrieveView(int viewResId){
       return (T)itemView.findViewById(viewResId);
    }
}
